<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    var lar = function(s) {
    var res = [];
    var n = s.length;
    var num = 1;
    for (let i = 0; i < n; i++) {
        if (s[i] !== s[i + 1]) {
            if (num >= 3) {
                res.push([i - num + 1, i]);
            }
            num = 1;
        } else {
            num++;
        }
    }
    return res;
};
console.log(lar("abcdddeeeeaabbbcd"));
  </script>
</body>
</html>